/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package trace;
import java.io.*;
/**
 *
 * @author Julien Cassis
 */
public class Writer {
        String filename;
        PrintWriter br;
        public Writer(String filename){
            this.filename = filename;
            try{
                FileWriter outFile = new FileWriter(this.filename);
                br = new PrintWriter(outFile);
           }catch (Exception e){
                System.err.println("Error: " + e.getMessage());
           }
        }

           public void close(){
            try{
                br.close();
            }catch(Exception e){
                System.err.println("Error: " + e.getMessage());
            }
           }

        public void writeToFile(String str){
                try{
                    br.println(str);
                }catch(Exception e){
                    System.err.println("Error: " + e.getMessage());
                }
        }
}
